package com.zip4j;

import org.apache.commons.lang3.time.StopWatch;

import java.util.ArrayList;

/**
 * @Description
 * @Author aoyebobi
 * @Date 2024-10-09
 */

public class ZipDemo {

    public static void main(String[] args) {
        String dir = "upload/";
        ArrayList<String> zipList = new ArrayList<>();
        zipList.add(dir + "1.png");
        zipList.add(dir + "2.png");
        zipList.add(dir + "3.png");
        //整体打包
        StopWatch started = StopWatch.createStarted();
        String zipPath = dir + "zip/test.zip";
        //生成压缩文件
        if (!ZipFileUntil.zipFile(zipPath,ZipFileUntil.ZIP_PS.toCharArray(),zipList)) {
            throw new RuntimeException("压缩文档失败");
        }
        started.stop();
    }
}
